<?php


// left_cells
echo '<div class="left_cells">';

// cell_empty / cell_bullet
if (isset($is_tree) && $is_tree) {
// cell_empty
//echo str_repeat('<div class="cell cell_empty cell_nbsp">&nbsp;</div>', $level);
// cell_bullet
echo '<div class="cell cell_bullet cell_bullet_off">' . $html->link($routine->icon('bullet_toggle_plus'), '#', array('title' => __('toggle_bullet_action', TRUE), 'escape' => FALSE)) . '</div>';
}

// cell_locked
if (isset($field_schema['locked'], $row[$model]['locked'])) {
	$toggle_locked_url = array('action' => 'toggle_locked', 'id' => $row[$model][$primary_key], 'autoPage' => TRUE);
	echo '<div class="cell cell_menu cell_locked cell_locked_' . ((bool)$row[$model]['locked'] ? 'on' : 'off') . '">' . $html->link($routine->icon((bool)$row[$model]['locked'] ? 'lock' : 'lock_open'), $toggle_locked_url, array('title' => __('toggle_locked_action', TRUE), 'escape' => FALSE)) . '</div>';
}

// cell_hidden
if (isset($field_schema['hidden'], $row[$model]['hidden'])) {
	$toggle_hidden_url = array('action' => 'toggle_hidden', 'id' => $row[$model][$primary_key], 'autoPage' => TRUE);
	echo '<div class="cell cell_menu cell_hidden cell_hidden_' . ((bool)$row[$model]['hidden'] ? 'on' : 'off') . '">' . $html->link($routine->icon((bool)$row[$model]['hidden'] ? 'bullet_red' : 'bullet_green'), $toggle_hidden_url, array('title' => __('toggle_hidden_action', TRUE), 'escape' => FALSE)) . '</div>';
}

// cell_disabled
if (isset($field_schema['disabled'], $row[$model]['disabled'])) {
	$toggle_disabled_url = array('action' => 'toggle_disabled', 'id' => $row[$model][$primary_key], 'autoPage' => TRUE);
	echo '<div class="cell cell_menu cell_disabled cell_disabled_' . ((bool)$row[$model]['disabled'] ? 'on' : 'off') . '">' . $html->link($routine->icon((bool)$row[$model]['disabled'] ? 'flag_red' : 'flag_green'), $toggle_disabled_url, array('title' => __('toggle_disabled_action', TRUE), 'escape' => FALSE)) . '</div>';
}

// cell_icon (cell_children_index)
if (isset($field_schema['created'], $field_schema['modified'], $row[$model]['created'], $row[$model]['modified']) && ($row[$model]['created'] === $row[$model]['modified'])) {
	$page_icon = 'page_white';
} else {
	$page_icon = 'page';
}
if (isset($is_tree) && $is_tree) {
	$children_index_url = array('action' => 'index', $row[$model][$primary_key], 'autoPage' => FALSE);
	echo '<div class="cell cell_menu cell_icon cell_children_index">' . $html->link($routine->icon('folder_' . $page_icon), $children_index_url, array('title' => __('children_index_action', TRUE), 'escape' => FALSE)) . '</div>';
} else {
	echo '<div class="cell cell_icon">' . $routine->icon($page_icon) . '</div>';
}

// cell_display_image
if (array_key_exists($display_image, $row[$model]) && isset($row[$model][$display_image . '-uploaded']) && is_array($uploaded = $row[$model][$display_image . '-uploaded'])) {
$style = 'height: ' . min($uploaded['height'], 50) . 'px';
//echo '<div class="cell cell_display_image cell_' . $display_image . '">' . $html->link($html->image($uploaded['url_time'], array('class' => 'thumbnail', 'style' => $style)), $uploaded['url_time'], array('class' => 'lightbox', 'escape' => FALSE)) . '</div>';
echo '<div class="cell cell_display_image cell_' . $display_image . '">' . $html->image($uploaded['url_time'], array('class' => 'thumbnail', 'style' => $style)) . '</div>';
}

// cell_display_field (cell_children_index)
if (isset($is_tree) && $is_tree) {
	$children_index_url = array('action' => 'index', $row[$model][$primary_key], 'autoPage' => FALSE);
	echo '<div class="cell cell_display_field cell_' . $display_field . ' cell_children_index">' . $html->link($row[$model][$display_field], $children_index_url, array('title' => __('children_index_action', TRUE))) . '</div>';
} else {
	echo '<div class="cell cell_display_field cell_' . $display_field . '">' . h($row[$model][$display_field]) . '</div>';
}

// cell_edit
$edit_url = array('action' => 'edit', 'id' => $row[$model][$primary_key], 'autoPage' => TRUE);
echo '<div class="cell cell_menu cell_edit">' . $html->link($routine->icon('pencil'), $edit_url, array('title' => __('edit_action', TRUE), 'escape' => FALSE)) . '</div>';

// cell_items_index
if (isset($has_items, $item_model) && $has_items) {
	if (isset($row[0]['num_items']) && ((int)$row[0]['num_items'] === 0)) {
		$items_index_icon = 'arrow_right_red';
	} else {
		$items_index_icon = 'arrow_right';
	}
	$items_index_url = array('controller' => Inflector::tableize($item_model), 'action' => 'index', $row[$model][$primary_key], 'autoPage' => FALSE);
	echo '<div class="cell cell_menu cell_items_index">' . $html->link($routine->icon($items_index_icon), $items_index_url, array('title' => __('items_index_action', TRUE), 'escape' => FALSE)) . '</div>';
	if (isset($row[0]['num_items'])) {
		echo '<div class="cell cell_num_items">' . $row[0]['num_items'] . '</div>';
	}
}

echo '</div>'; // end of left_cells


?>